package com.sjq.common.service.impl;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.sjq.common.dao.DeptDao;
import com.sjq.common.entity.Dept;
import com.sjq.common.exception.ServiceException;
import com.sjq.common.service.DeptService;
import com.sjq.common.util.PageResults;

@Service("deptService")
public class DeptServiceImpl implements DeptService{
	
	@Autowired
	private DeptDao deptDao;
	
	@Override
	public void addDept(Dept dept) {
		if(dept==null){
			return;
		}
		deptDao.insertDept(dept);
	}
	
	@Override
	public void removeDept(String deptCode) {
		deptDao.deleteDeptById(deptCode);
	}

	@Override
	public void modifyDept(Dept dept) {
		if(dept==null){
			return;
		}
		deptDao.updateDept(dept);
	}

	@Override
	public Map<String, Object> findDeptById(String deptId) throws ServiceException {
		Map<String, Object> map=deptDao.selectDeptById(deptId);
		return map;
	}

	@Override
	public PageResults<?> findDeptByPage(int pageNo, int pageSize, Dept dept) throws ServiceException {
		PageResults<?> pageResults=deptDao.selectDeptByPage(pageNo, pageSize, dept);
		return pageResults;
	}




}
